package com.demo.mybatis;

import java.lang.reflect.Proxy;
import com.demo.mybatis.executor.CExecutor;
import com.demo.mybatis.executor.impl.SimpleExecutor;



public class CsqlSession {
	
	private CExecutor executor = new SimpleExecutor();
	
	 public <T> T selectOne(String sql, Object parameter) {
	        return executor.query(sql,parameter);
	    }
	
	
	
	@SuppressWarnings("unchecked")
	public <T> T getMapper(Class<T> clazz){
		return (T)Proxy.newProxyInstance(this.getClass().getClassLoader(),
				new Class[]{clazz}, new CMapperProxy<T>(this));
	}

}
